package 第八章;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@WebServlet("/demo1")
public class Servlet01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Brand> brands = new ArrayList<Brand>();
        brands.add(new Brand(1,"百草味","百草味",100,"百草味芒果干,你值得信赖",1));
        brands.add(new Brand(2,"ERKE","ERKE",200,"追求时尚,引领全球 to be no. 1 鸿星尔克!",0));
        brands.add(new Brand(3,"一加","深圳市万普拉斯科技有限公司",1000,"Never Settle",1));
        request.setAttribute("brands",brands);
        request.setAttribute("status",1);
        request.getRequestDispatcher("/jstl-foreach.jsp").forward(request,response);
    }
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
